From b9eb02ebbe25f5642fd5cfba354dfa18c52076ca Mon Sep 17 00:00:00 2001 From: Cosimo Cecchi Date: Thu, 3 May 2012 15:00:38 -0400 Subject: [PATCH] colorbutton: don't hardcode a 16px margin around the color sample Since themes might want different paddings around the color sample according to where it's being used, don't hardcode a 16px one here. The theme can specify a padding to get the same effect. Reported by Christian Persch --- gtk/gtkcolorbutton.c | 11 +---------- 1 file changed, 1 insertion(+), 10 deletions(-) diff --git a/gtk/gtkcolorbutton.c b/gtk/gtkcolorbutton.c index ab2821fa41..7ad5cd5ea1 100644 --- a/gtk/gtkcolorbutton.c +++ b/gtk/gtkcolorbutton.c @@ -60,8 +60,6 @@ #define CHECK_DARK (1.0 / 3.0) #define CHECK_LIGHT (2.0 / 3.0) -#define COLOR_SAMPLE_MARGIN 1 - struct _GtkColorButtonPrivate { GtkWidget *draw_area; /* Widget where we draw the color sample */ @@ -437,19 +435,12 @@ gtk_color_button_init (GtkColorButton *button) gtk_widget_push_composite_child (); button->priv->draw_area = gtk_drawing_area_new (); - g_object_set (button->priv->draw_area, - "margin-top", COLOR_SAMPLE_MARGIN, - "margin-bottom", COLOR_SAMPLE_MARGIN, - "margin-left", 16, - "margin-right", 16, - NULL); - layout = gtk_widget_create_pango_layout (GTK_WIDGET (button), "Black"); pango_layout_get_pixel_extents (layout, NULL, &rect); g_object_unref (layout); gtk_widget_set_size_request (button->priv->draw_area, - rect.width, rect.height - 2 * COLOR_SAMPLE_MARGIN); + rect.width, rect.height); g_signal_connect (button->priv->draw_area, "draw", G_CALLBACK (gtk_color_button_draw_cb), button); -- 2.30.2